<?php


namespace App\Base;


class RouteHandle
{
    public static $route = [];
    public static $middleware = [];
    public static $currentName = '';

    public static function push(string $name, string $method)
    {
        self::$currentName = $name;
        self::$route[$name] = $method;
        return new self();
    }

    public function middleware(string $middlewareName)
    {
        self::$middleware[self::$currentName] = $middlewareName;
    }

    public static function currentMiddleware()
    {
        return self::$middleware[$_GET['route'] ?? ''] ?? '';
    }
}